#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>      
#include <string.h>
#include <assert.h>

void* my_memmove(void* dest, const void* src,size_t num)
{
	void* temp = dest;
	assert(dest && src);
	if (dest < src)
	{
		while (num--)
		{
          * (char*)dest = *(char*)src;
          (char*)dest = (char*)dest + 1;
          (char*)src = (char*)src + 1;
	    }
	}
	else
	{
		while (num--)
		{
			*((char*)dest + num) = *((char*)src + num);
		}
	}
	return temp;
}

int main()
{
	char arr1[] = "abcdefgh";
	//             ababcdeh
	my_memmove(arr1+2, arr1, 5);
	printf("%s\n", arr1);
	return 0;
}